// 字符串全排列问题
// 例如：ABC ACB BAC BCA 。。
const FullArrangement = function (str) {
  let result = []
  if (str.length <= 1) {
    return [str]
  } else {
    for (let i = 0; i < str.length; i++) {
      let flag = str[i]
      let newStr = str.slice(0, i) + str.slice(i + 1, str.length)
      let l = FullArrangement(newStr);
      for (let j = 0; j < l.length; j++) {
        let tmp = flag + l[j];
        3
        result.push(tmp);
      }
    }
  }
  return result
}

console.log(FullArrangement('ABC'))